define(function(require, exports, module) {
  var common = require('common'),
      lang = require('lang');
  module.exports = Backbone.Model.extend({
    defaults: {
      todoid: '',
      today: moment().format(common.format.moment.date),
      from: moment().format(common.format.moment.time),
      to: '18:00',
      hours: 8,
      detail: ''
    },
    idAttribute: 'objectId',
    validate: function(attrs, options) {
      if(_.isEmpty(attrs.todoid)) return lang.get('todo') + lang.get('not_allowed_empty');
      if(_.isEmpty(attrs.today)) return lang.get('date') + lang.get('not_allowed_empty');
      if(parseFloat(attrs.hours) < 0) return lang.get('hours', 'todo') + lang.get('not_allowed_empty');
      if(attrs.to <= attrs.from) return lang.info('108');
    }
  });
});